@highlight-ui/utils-portal-manager
Installation
yarn add @highlight-ui/utils-portal-manager
Usage
In (S)CSS:
@import url('@highlight-ui/utils-portal-manager');
PortalManager.containerInstance()
This function creates, or if it exists, returns the global portals container DOM
element.
import { PortalManager } from '@highlight-ui/utils-portal-manager';
const newPortalsContainer = PortalManager.containerInstance();
const existingPortalsContainer = PortalManager.containerInstance();
console.log(newPortalsContainer == existingPortalsContainer);
GroupedPortal
React component that appends a portal to the global portals container.
import { GroupedPortal } from '@highlight-ui/utils-portal-manager';
const MyComponent = () => {
return (
<GroupedPortal>
This content is rendered in the global portals container.
</GroupedPortal>
);
};